home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_400
/
425_01
/
tar
/
tar.txt
< prev
next >
Wrap
Text File
|
1980-07-23
|
26KB
|
659 lines
'tar' - is an acronym for 'tape archiver'
It is a tool to save files to archive media and restore them back
again. Despite of its name, the program handles many media types,
be it a floppy disk or regular file.
The program was initially written for UNIX operating system, but
since many other OS support its format, tar became a useful tool
for information exchange between different platforms.
This document describes yet another implementation of the program,
which could be noted for portability between MS-DOS and UNIX
clones, portability both in data format and source text level.
System requirements
Program will execute
- on any IBM PC compatible computer running MS-DOS 3.0 or
compatible OS;
- any generic UNIX clone.
Before running the program you will probably have to compile it,
especially if you are a UNIX user. To do that you should have:
- any C compiler compatible with K&R or ANSI standard - for
UNIX version;
- Turbo C v2.0 under MS-DOS 3.30 - for DOS version.
Declaring such a wide portability shall probably have some
restrictions, but, alas, I do not know about them.
The size of free memory required for program depends of the action
selected. As a rule, about 64K bytes is enough to read/write
archives without compression. If you are going to use compression
options, the program can take all the megabytes available.
Anyway, the program will be able to process archive in a regular
file (see below). It also supports floppy diskettes under MS-DOS.
Media types available under UNIX is determined by device drivers
available in the system.
Running the program
The program can be run simply from command line. You have to type
to the system prompt a line with the following syntax:
Tar <options> <args> <file> ...
where options define both action to perform and some additional
options. You have to specify at least one option to define
action, and command line must contain only one action option.
Options can be preceded by '-' (minus) sign.
Traditional command line syntax requires all the options to be
typed in place, as a single command line argument. Some of the
options require parameters, such as numerical value or a file
name. Such parameters must follow the options, separated by
spaces, exactly in the order of respective options.
The rest of the command line contains a list of files to extract
from archive or to store. This file list can be omitted for
extraction options, such as 't' or 'x', in this case the program
will process all the files in archive; other options makes the
list obligatory.
You may use wildcards '?' and '*' in file names both under DOS and
UNIX. Note, however, that UNIX version can not process wildcards
for files which are not in archive, this is done by command
processor - e.g. shell - instead. Consult your manual for the
details of wildcard processing.
Here follows the list of options along with their descriptions
(unlike most other implementations this program is case
insensitive, i.e., makes no difference between upper and lowercase
letters):
a - add (store) files to archive, the option is fully analogous
to traditional 'r' option, and was added to user convenience.
You have to specify the list of files to be stored.
Note, that normally files are appended to the end of archive,
so the archive can contain several files with the same name;
by default, the program will extract the latest version. Such
a behavior may be changed by 'c', 'd' and 'w' options.
x - extract files from archive; program extracts specified files,
if no file name is given, the whole archive will be
extracted. If the directory name appears in command line, the
program extracts all of the files and subdirectories in a
given directory.
t - type archive directory. The files to be processed are defined
as for the 'x' command.
The program outputs list of file names, unless 'v' modifier
is given. With 'v' option each file name is preceded by its
UNIX access rights mask, numeric user and group identifiers
and file length in bytes. Usage with 'e' or 'z' option forces
printing both compressed and original file lengths.
d - the specified files will be deleted from archive; this option
is for file archives only.
r - read files from disk to archive; the option is an alias for
'a', it is preserved for the compatibility reasons.
c - the 'a' option implies that archive media contains an
existing tar archive, or archive file already exists. The 'c'
option creates a new archive or overwrites old one (if
any). This option also implies 'a' so you do not need to
specify it.
y - delete files and directories after storing them into archive.
This option implies 'a'.
u - update archive. Normally program stores all of the files
specified. Given option causes tar to store files only if
they are not present in archive or if the files were
modified.
This option implies 'a'.
i - ignore read errors. This option may help (but may not) to
restore damaged archive.
v - verbose. Normally program works silently; this option
forces printing of a log with most operations or produces
a lot of additional information with 't' option.
w - the program will ask for your confirmation before processing
each file.
e - apply a compression to archive files. The compression
algorithm has rather good compression ratio, but is
processor intensive. Besides, you won't be able to
restore the compressed file by standard 'tar' program - use
this option carefully.
z - compress files in archive with traditional UNIX algorithm.
It is much faster than previous option, and it is compatible
with most Unix systems, so you can extract files with
'uncompress' or even 'tar' program alone, but this algorithm
has comparatively low compression ratio.
You may specify 'bits' factor typing it immediately after
z letter (e.g. z12); note, that this rule does not follow
regular command line syntax. See 'compress' program manual
to understand 'bits' factor meaning.
, - (comma) this option is similar to 'z', but the whole archive
will be (de)compressed rather than individual files.
. - (dot) this option is similar to ',' (comma) and allows to
read deflated archive in regular zip or GNU zip format or
create compressed archives in regular zip format. In the
latter case it's possible to specify compression level by
the single digit immediately after dot sign; legal values are
form 1 to 9 (the more compression level, the better
compression ratio will be).
s - program will not process '?' and '*' wildcards in archive
file names.
m - sets modification time of files to current time. By default
the program sets date and time of modification for extracted
files exactly as they have before they have been placed into
archive.
o - option meaning depends on the host operating system, namely
under UNIX it means -
omit files owner. By default program tries to restore
original files owner and group. The option forces tar to set
the user who invokes tar as files owner, which is
especially useful when files are marked with zero owner,
i.e. root'.
under DOS respectively -
prevent files overwriting. Since UNIX file names are longer
than DOS, there is a chance that two or more UNIX files will
have same DOS names, so they couldn't co-exist onto DOS disk.
If the 'o' option given, the program will rename extracted
file if there is a file on the disk with the same name.
This option can also affect multivolume processing. Namely,
if two different UNIX files have same DOS names and second
file is fragmented between volumes then extents of the second
file will be appended to first one. Alas, I see no solution
for this problem.